import request from '@/utils/request'

export default {
  // 获取订单列表
  getOrders(params) {
    return request({
      url: '/orders',
      method: 'get',
      params
    })
  },
  
  // 获取订单详情
  getOrder(id) {
    return request({
      url: `/orders/${id}`,
      method: 'get'
    })
  },
  
  // 创建订单
  createOrder(data) {
    return request({
      url: '/orders',
      method: 'post',
      data
    })
  },
  
  // 更新订单
  updateOrder(id, data) {
    return request({
      url: `/orders/${id}`,
      method: 'put',
      data
    })
  },
  
  // 删除订单
  deleteOrder(id) {
    return request({
      url: `/orders/${id}`,
      method: 'delete'
    })
  },
  
  // 取消订单
  cancelOrder(id) {
    return request({
      url: `/orders/${id}/cancel`,
      method: 'post'
    })
  }
} 